﻿using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.BuyerScarletInformation.Dto;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.BuyerScarletInformation
{
    /// <summary>
    /// 购方红字信息表接口
    /// </summary>
    [Authorize]
    [ApiController]
    [Route("api/BuyerScarletInformation")]
    public class BuyerScarletInformationController : BPMReportPlatformController

    {
        private readonly IBuyerScarletInformationService _buyerScarletInformationService;

        public BuyerScarletInformationController(IBuyerScarletInformationService buyerScarletInformationService)
        {
            _buyerScarletInformationService = buyerScarletInformationService;
        }
        /// <summary>
        /// 见单生产查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("GetAllAsync")]
        public async Task<PagedResultDto<GetBuyerScarletInformationOutput>> GetAllAsync([FromBody] GetBuyerScarletInformationInput input)
        {
            return await _buyerScarletInformationService.GetAllAsync(input);
        }

        /// <summary>
        /// 见单生产导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ExportAsync")]
        public async Task<XlsxFileResult<GetBuyerScarletInformationOutput>> ExportAsync([FromBody] GetBuyerScarletInformationInput input)
        {
            var rst = await _buyerScarletInformationService.ExportAsync(input);
            return new XlsxFileResult<GetBuyerScarletInformationOutput>(rst, "导出Excel");
        }



    }
}

